main(n,m)
{
	for(gets(&n);~scanf("%d%d",&n,&m);printf("%ld\n",1L*(m-n+1)*(m+n)/2));
}
